/**
 * 项目唯一入口模块
 * @author wangbing
 * @datatime 2016年1月5日11:21:38
 */

require.config({
		waitSeconds:0,
		//默认第三方插件模块路径
		baseUrl: "common/vendor",

		//禁止JS缓存、生产环境要删除
		urlArgs: "bust=" + (new Date()).getTime(),

		//全局各个模块常量配置
		config: {

		},

		//从包管理器中加载模块
		packages: [{
			name: "jquery",
			location: "jquery/1.11.3",
			main: "jquery.min"
		}],

		//文件路径配置
		paths: {
			//定义模块路径变量、目前为开发环境的目录、生产目录为dist
			app: "../../app",

			styles: "../../common/resources/styles",

			core: "../../app/core",
			//公共JS脚本模块
			common: "../resources/scripts",

			myPlu: "../../plugins",
			//默认的项目主模块
			main: "../../app/core/main",

			//以下为第三方插件、框架
			router: "router/director.min",

			echarts: 'http://echarts.baidu.com/build/dist',

			juicer: "tpl-engine/juicer/0.6.8/juicer-min",

			humaneRoot: "humane",

			humane: "humane/humane.min",

			swal: "alert/swal/sweetalert.min",

			underscore: "__/1.8.2/underscore-min",

			amazeuiRoot: "amaze-ui/2.5.0",

			amazeui: "amazeuiRoot/assets/js/amazeui.min",

			bootstrapRoot: "b/3.3.5",

			bootstrap: "b/3.3.5/js/bootstrap.min",

			easyuiRoot: "easy-ui/1.4.3",

			easyui: "easy-ui/1.4.3/jquery.easyui.min",

			socketio: "web-socket/socket.io-1.3.7",
			
			hc:"http://cdn.bootcss.com/html2canvas/0.5.0-beta4/html2canvas",
			
			ec:"echarts.min",
			
			b64:"base64.min"
		},
		map: {
			"*": {
				"css": "requirejs-css/css"
			}
		},
		//shim配置
		shim: {

			juicer: {
				init: function() {
					juicer.set({
						'tag::interpolateOpen': '&&{',
						'tag::interpolateClose': '}',
						'tag::noneencodeOpen': '&&&{',
						'tag::noneencodeClose': '}'
					});
					
					juicer.register("timeFormat",function(val){
						if(val){
							return new Date(Number(val)).toLocaleString(); 
						}
						return "";
					})

					return juicer;
				}
			},
			
			
			hc:{
				
				init:function(){
					return html2canvas;
				}
				
			},
			
			b64:{
				
				init:function(){
					return Base64;
				}
				
			},
			
			ec:{
				
				init:function(){
					return echarts;
				}
				
			},

			router: {
				init: function() {
					return Router;
				}
			},

			humane: {
				deps: [
					"css!humaneRoot/themes/flatty.css"
				],
				init: function() {
					return humane;
				}
			},

			swal: {
				deps: [
					"css!alert/swal/sweetalert.css"
				],
				init: function() {
					return swal;
				}
			},

			main: {
				deps: [
					"css!animate.min.css",
					"css!styles/style.css",
					"css!styles/normalize.css",
					"css!bootstrapRoot/css/bootstrap.grid.css",
					"css!ltbox/css/lightbox.min.css",
					"ltbox/js/lightbox.min"
				]
			},

			amazeui: {
				deps: [
					"css!amazeuiRoot/assets/css/amazeui.flat.min.css",
					"jquery"
				]
			},

			bootstrap: {
				deps: [
					"css!bootstrapRoot/css/bootstrap.min.css",
					"css!bootstrapRoot/css/bootstrap.theme.min.css",
					"jquery"
				]
			},

			easyui: {
				deps: [
					"css!easyuiRoot/themes/metro-gray/easyui.css",
					"css!easyuiRoot/themes/icon.css",
					"css!styles/fixed.css",
					"jquery",
				]
			}
		}
	})
	/**
	 * 项目入口函数
	 * 默认加载jQuery，main模块
	 */
require([
	"jquery",
	"underscore",
	"router",
	"easyui",
	"main",
	"core/util"
	//TODO ... 加入其他的模块

], function($, ___, _Rt, ui,main,util) {

	require(["easyuiRoot/datagrid-cellediting"
	,"easyuiRoot/datagrid-detailview"])
	
	if(navigator.userAgent.indexOf("Chrome")==-1){
		util.toast("请使用Chrome浏览器","error");
		setTimeout(function(){
			window.location.href="/login";
		},2000)
		return 
	}
	
	$.parser.parse();

	//路由使用Demo
	var _Rconfig = {
		"/author": function() {
			alert();
		}
	}
	_Rt(_Rconfig).init();

	main.init($("#jobId").val());

	//Toast提示框

	//Confirm提示框


})